home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Language / Compiler / Builtins / Real.m < prev    next >
Text File  |  1990-08-16  |  2KB  |  84 lines

  1. % @(#)Real.m    1.2  6/29/87
  2. %
  3. export _RealObject to "Builtins"
  4.  
  5. const _RealObject == immutable object _RealObject
  6.   export getSignature, create
  7.   const RealType == immutable type RealType
  8.     function + [o : Real] -> [r : Real]
  9.       % r <- self + o
  10.     function - [o : Real] -> [r : Real]
  11.       % r <- self - o
  12.     function * [o : Real] -> [r : Real]
  13.       % r <- self * o
  14.     function / [o : Real] -> [r : Real]
  15.       % r <- self / o
  16.     function > [o : Real] -> [r : Boolean]
  17.       % r <- self > o
  18.     function >= [o : Real] -> [r : Boolean]
  19.       % r <- self >= o
  20.     function < [o : Real] -> [r : Boolean]
  21.       % r <- self < o
  22.     function <= [o : Real] -> [r : Boolean]
  23.       % r <- self <= o
  24.     function = [o : Real] -> [r : Boolean]
  25.       % r <- self = o
  26.     function != [o : Real] -> [r : Boolean]
  27.       % r <- self != o
  28.     function asString -> [r : String]
  29.       % s is set to a string with no leading 0's, decimal rep.
  30.     function asInteger -> [r : Integer]
  31.       % s is set to an integer (rounded)
  32.     function ~ -> [r : Real]
  33.       % r <- negate self
  34.   end RealType
  35.   function getSignature -> [result : Signature]
  36.     result <- RealType
  37.   end getSignature
  38.   function create [rep : String] -> [result : RealType]
  39.     result <- immutable object aReal
  40.       export +, -, *, /, >, >=, <, <=, =, !=, asString, asInteger, ~
  41.       function + [o : Real] -> [r : Real]
  42.     primitive 010 [r] <- [o]
  43.       end +
  44.       function - [o : Real] -> [r : Real]
  45.     primitive 110 [r] <- [o]
  46.       end -
  47.       function * [o : Real] -> [r : Real]
  48.     primitive 210 [r] <- [o]
  49.       end *
  50.       function / [o : Real] -> [r : Real]
  51.     primitive 310 [r] <- [o]
  52.       end /
  53.       function > [o : Real] -> [r : Boolean]
  54.     primitive 510 [r] <- [o]
  55.       end >
  56.       function >= [o : Real] -> [r : Boolean]
  57.     primitive 610 [r] <- [o]
  58.       end >=
  59.       function < [o : Real] -> [r : Boolean]
  60.     primitive 710 [r] <- [o]
  61.       end <
  62.       function <= [o : Real] -> [r : Boolean]
  63.     primitive 810 [r] <- [o]
  64.       end <=
  65.       function = [o : Real] -> [r : Boolean]
  66.     primitive 910 [r] <- [o]
  67.       end =
  68.       function != [o : Real] -> [r : Boolean]
  69.     primitive 1010 [r] <- [o]
  70.       end !=
  71.       function asString -> [r : String]
  72.     primitive 1110 [r] <- []
  73.       end asString
  74.       function asInteger -> [r : Integer]
  75.     primitive 1210 [r] <- []
  76.       end asInteger
  77.       function ~ -> [r : Real]
  78.     primitive 1310 [r] <- []
  79.       end ~
  80.     end aReal
  81.   end create
  82. end _RealObject
  83.